
#include "Case.h"
#include "Tresor.h"

direction Case::getDirectionFromInt(int i){
	
	switch(i){
		case 0:return haut;
		case 1: return droite;
		case 2: return bas;
		case 3 : return gauche;
	}
	
	return haut;

}

Case::Case(){
	_contenu=NULL;
	_orientation=haut;
}

Case::Case(direction orient, Tresor * tre){
	_orientation=orient;
	_contenu=tre;
}

Case::Case(int orient, Tresor * tre){
	_orientation=getDirectionFromInt(orient);
	_contenu=tre;
}

void Case::pivoter(direction dir) {
	_orientation=dir;
}	

void Case::pivoter(int dir) {
	_orientation=getDirectionFromInt(dir);
}

string Case::getTresor() {
	if(_contenu!=NULL){
		return _contenu->getNom();
	}

	return "";
}

direction Case::getDirection() {
	 return _orientation;
}


